import time
import tornado.web
import tornado.httpserver
import tornado.ioloop


class MainHandler(tornado.web.RequestHandler):
    def get(self):
        book = ["php", "C#", "<script>alert('sb')</script>"]
        self.render("index.html", book=book)



class testHandler(tornado.web.RequestHandler):
    def get(self, args):
        book = list(args)
        self.render("index.html", book=book)

    def post(self,args):

        name=self.get_argument(name="name",default="laowang")

        self.write(name)


if __name__ == '__main__':
    app = tornado.web.Application(
        handlers=[(r"/a/(\w+)", testHandler),
                  (r'/', MainHandler)]
    )
    server = tornado.httpserver.HTTPServer(app)
    server = server.listen(8848)
    tornado.ioloop.IOLoop.instance().start();
